import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
  state: {
  		token:"",
      auth:""
  },
  actions: {

  },
  mutations: {
    // '13790718636'
  	setUserToken(state,newtoken){
      window.localStorage.setItem('userToken',newtoken);
      state.token = newtoken       
    },
    setAuth(state,code){
      window.localStorage.setItem('auth',code);
      state.auth = code
    }

  },
  getters: {
    getUserToken(state){
       let localData = window.localStorage.getItem('userToken')

          if(state.token === ""&&localData){
             state.token = localData
          }
          
      return state.token;
    },
    getAuth(state){
        
        let localData = window.localStorage.getItem('auth')

          if(localData){
             state.auth = localData
          }else{
              state.auth=""
          }



      return state.auth;
    }
  }
})
export default store